import * as fetch from 'common/fetch.js';

/**
 * 商品分类列表
 */
export function shopClassifyList({page, limit, classifyName}) {
  return fetch.get('/shopClassify/list?page='+page+"&limit="+limit+"&classifyName="+classifyName);
}

/**
 * 商品分类详情
 */
export function shopClassifyDetail({id}) {
  return fetch.get('/shopClassify/detail?id='+id);
}

/**
 * 商品分类编辑
 */
export function shopClassifyEdit({classifyId, classifyName}) {
  return fetch.post('/shopClassify/edit',{classifyId, classifyName});
}

/**
 * 商品分类删除
 */
export function shopClassifyDel({id}) {
  return fetch.post('/shopClassify/del',{id});
}

/**
 * 商品列表
 */
export function shopGoodsList({page, limit, goodsName}) {
  return fetch.get('/shopGoods/list?page='+page+"&limit="+limit+"&goodsName="+goodsName);
}

/**
 * 商品详情
 */
export function shopGoodsDetail({id}) {
  return fetch.get('/shopGoods/detail?id='+id);
}

/**
 * 商品编辑
 */
export function shopGoodsEdit({goodsId, goodsName, goodsTitle, goodsImage, goodsBody, goodsPrice, goodsStock, classifyId, classifyName}) {
  return fetch.post('/shopGoods/edit',{goodsId, goodsName, goodsTitle, goodsImage, goodsBody, goodsPrice, goodsStock, classifyId, classifyName});
}

/**
 * 商品删除
 */
export function shopGoodsDel({id}) {
  return fetch.post('/shopGoods/del',{id});
}

/**
 * 订单列表
 */
export function shopOrderList({page, limit, orderSn, buyerName}) {
  return fetch.get('/shopOrder/list?page='+page+"&limit="+limit+"&orderSn="+orderSn+"&buyerName="+buyerName);
}